
import os

def getParentDir(path):
    '''This method try to find parent dir
       default path is dir (exist, or non-exist)
       if path is exist we check if it is file'''
    out = path
    if path.startswith('.'):
        out = os.path.abspath(path)
        
    if os.path.exists(out) and os.path.isfile(out):
        out = out.replace(os.path.basename(out), '')
    if out[-1] in ('/', '\\'):
        out = out[:-1]
    return out.replace(os.path.basename(out), '')
    



